/**
 * 仿Promise.withResolvers
 * @param fn boolean 是否返回为回调函数
 * @return array 根据参数fn差异:
 * 		false: [promise, resolve, reject]
 * 		true: [promise, (e,v)=>e?E(e):Y(v)]
 */
$.when = function(fn=false){
	let Y, E, W=new Promise((y,n)=>{ Y=y; E=n; });
	return fn ? [W,(e,v)=>e?E(e):Y(v)] : [W,Y,E];
};
